package com.wc.codeforces.思维.Subsequence_Update;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/5/5 17:42
 * @description
 * https://codeforces.com/contest/2063/problem/B
 */
public class Main {
    /**
     * 思路:
     * 要么只和左边换
     * 要么只和右边换
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    static int[] a = new int[N];
    static int n, l, r;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextInt();
            l = sc.nextInt();
            r = sc.nextInt();
            for (int i = 1; i <= n; i++) a[i] = sc.nextInt();
            Arrays.sort(a, 1, l);
            Arrays.sort(a, l, r + 1);
            Arrays.sort(a, r + 1, n + 1);
            long sum1 = work(1, l - 1), sum2 = work(r + 1, n);
            long res = Math.min(sum1, sum2);
            out.println(res);
        }
        out.flush();
    }

    /**
     * 二路合并
     * @param x1 左边
     * @param x2 右边
     */
    static long work(int x1, int x2) {
        long sum = 0;
        int i = x1, j = l, len = r - l + 1;
        while (i <= x2 && j <= r && len > 0) {
            if (a[i] <= a[j]) sum += a[i++];
            else sum += a[j++];
            len--;
        }
        while (j <= r && len > 0) {
            sum += a[j++];
            len--;
        }
        return sum;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

